package com.itao.poi.tl;

import com.deepoove.poi.XWPFTemplate;
import com.deepoove.poi.data.Numberings;
import com.deepoove.poi.util.PoitlIOUtils;
import com.itao.poi.tl.util.ResourceUtil;

import java.io.FileOutputStream;
import java.util.HashMap;

/**
 * 列表标签{{*lebalName}}
 *
 * @author sjt
 * @Date 2024/10/10 8:54
 */
public class ListLebal {

    public static void main(String[] args) throws Exception {
        XWPFTemplate template = XWPFTemplate.compile(ResourceUtil.getDocxPath("list_template.docx"))
                .render(new HashMap<String, Object>() {
                            {
                                put("list", Numberings.ofDecimal(
                                                "Plug-in grammar",
                                                "Supports word text, pictures, table...",
                                                "Not just templates"
                                        ).create()
                                );
                            }
                        }
                );
        FileOutputStream fos = new FileOutputStream(ResourceUtil.getDocxOutPath("list_template.docx"));
        template.writeAndClose(fos);
        PoitlIOUtils.closeQuietlyMulti(template, fos);
    }
}
